<?php if (isset($product_relative) && (count($product_relative)>0)) :?>
<div id="product_relative">
    <div class="product_sort">
        <h1>
            Sản phẩm cùng loại
            <ul class="product_view">
                <li id="product_view_grid" class=""></li>
                <li id="product_view_list" class="current"></li>
            </ul>
        </h1>
    </div>
    <ul id="product_list" class="bordercolor list">
        <?php foreach($product_relative as $key => $value) :
        $product_link = base_url('san-pham/'.$value['product_id'].'_'.url_friendly($value['title']).'.html');
        ?>
        <li class="ajax_block_product bordercolor">
            <a href="<?php echo $product_link;?>" class="product_img_link" title="<?php echo $value['title'];?>">
                <img onerror="ImgError(this);" width="180" height="180" src="<?php echo render_image('/uploads/product/'.$value['product_id'].'/'.md5($value['product_id']).'.jpg', 180, 180, '1.1');?>" alt="<?php echo $value['title'];?>" />
            </a>
            <div class="center_block">
                <div class="product_flags">
                    <span class="new"><?php echo $value['status_flag'] == 0 ? 'Cũ' : 'Mới';?>!</span>
                    <span class="availability bordercolor"><?php echo $value['quantity'] > 0 ? 'Còn hàng' : 'Hết hàng';?></span>
                </div>
                <h3><a class="product_link" href="<?php echo $product_link;?>" title="<?php echo $value['title'];?>"><?php echo $value['title'];?></a></h3>
                <p class="product_desc">
                    <a class="product_descr" href="#" title="<?php echo $value['intro'];?>"></a>
                </p>
                <p>
                    <a class="product_descr" href="#" title="<?php echo $value['intro'];?>"><?php echo $value['intro'];?></a>
                </p>
            </div>
            <div class="right_block bordercolor">
                <span class="price">
                    <?php if ($value['price_old'] < $value['price_new']):?>
                        <span style="text-decoration: line-through; font-size: 16px; font-weight: bold;"><?php echo currency_format($value['price_old']);?> VND</span><br />
                        <span style="font-size: 16px;  font-weight: bold; color: red;"><?php echo currency_format($value['price_new']);?> VND</span>
                    <?php else :?>
                        <?php echo currency_format($value['price_old']);?> VND
                    <?php endif;?>
                </span>
                <!-- <p class="compare checkbox">
                    <input type="checkbox" class="comparator" id="comparator_item_list<?php echo $value['product_id'];?>" value="comparator_item_<?php echo $value['product_id'];?>">
                    <label for="comparator_item_list7">So sánh</label>
                </p> -->
                <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_<?php echo $value['product_id'];?>" href="<?php echo base_url();?>" title="Thêm vào giỏ">Thêm vào giỏ</a><br>
                <a class="button" href="<?php echo $product_link;?>" title="View">Xem</a>
            </div>
        </li>
        <?php endforeach;?>
    </ul>
</div>
<?php endif;?>